package com.hxc.mapper;

import com.hxc.entity.Emp;
import com.hxc.entity.EmpQueryParam;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface EmpMapper {
    // 统计总数
//    @Select("select count(*) from emp")
//    Long getAllCount();
//    // 按页查询
//    @Select("select e.*,d.name deptName from emp e left join dept d on e.dept_id = d.id limit #{start},#{pageSize}")
//    List<Emp> page(Integer start, Integer pageSize);

    // 使用pagehelper框架
    List<Emp> page(EmpQueryParam param);
    //@Options(useGeneratedKeys = true,keyProperty = "id")
    void addEmp(Emp emp);
    void deleteEmp(List<Integer> ids);

    @Select("select * from emp where id = #{id}")
    Emp getEmpById(Integer id);

    void update(Emp emp);
    @Select("select * from emp")
    List<Emp> getAllEmp();
    @Select("select * from emp where username=#{username} and password=#{password}")
    Emp selectUsernameAndPassword(Emp emp);
}
